package com.yami.shop.seckill.multishop.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yami.shop.seckill.common.model.SeckillSku;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * 保存秒杀信息参数
 *
 * @author LGH
 * @date 2019-08-28 09:36:59
 */
@Data
public class SeckillParam {
    private static final long serialVersionUID = 1L;

    @Schema(description = "秒杀活动id")
    private Long seckillId;

    @Schema(description = "活动名称")
    @NotNull
    private String seckillName;

    @Schema(description = "开始时间")
    @NotNull
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    @Schema(description = "结束时间")
    @NotNull
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @Schema(description = "活动标签")
    private String seckillTag;

    @Schema(description = "限购数量")
    private Integer maxNum;

    @Schema(description = "取消订单时间")
    @Min(2)
    @Max(15)
    @NotNull
    private Integer maxCancelTime;

    @Schema(description = "商品id")
    @NotNull
    private Long prodId;

    @Schema(description = "秒杀商品规格列表")
    @NotNull
    @NotEmpty
    private List<SeckillSku> seckillSkus;
}
